package net.cyue.easyconfiguration.node.util;

import java.lang.reflect.Array;

public class ArrayUtil {

    public static Object[] cast(Object[] array, Class<?> componentType) {
        if (array == null) {
            return null;
        }
        Object[] result = (Object[]) Array.newInstance(componentType, array.length);
        if (array.length > 0) {
            System.arraycopy(array, 0, result, 0, array.length);
        }
        return result;
    }
}
